/**
 * Created by baodong on 15/10/4.
 */

function httpRequest(url,callback){
    var xhr = new XMLHttpRequest();

    xhr.open("GET",url,true);

    xhr.onreadystatechange = function(){
        if(xhr.readyState == 4)
        callback(true);
    }

    xhr.onerror = function(){
        callback(false);
    }

    xhr.send();
}

//每60秒钟检测一次
setInterval(function () {
    httpRequest("http://lookmanhua.com",function(status){
       chrome.browserAction.setIcon(
           {path:(status?"lukalogo.png":"alarm.png")}
       );
    });
},60000);